home *** CD-ROM | disk | FTP | other *** search
Wrap
package iCat; import com.netobjects.nfc.api.CStringArray; import com.netobjects.nfc.api.ComponentApp; import com.netobjects.nfc.api.DAssetManager; import com.netobjects.nfc.api.DDrawPicture; import com.netobjects.nfc.api.DFile; import com.netobjects.nfc.api.DImage; import com.netobjects.nfc.api.DLayout; import com.netobjects.nfc.api.DMessageBox; import com.netobjects.nfc.api.DRect; import com.netobjects.nfc.api.DSite; import com.netobjects.nfc.api.DSize; import com.netobjects.nfc.api.IDInspector; public class iCatBuilt extends ComponentApp { String strImageFile = ""; String strStoreURL = ""; int Image; DDrawPicture cdp; String codebase; DAssetManager assetMan; public void onCopy() { this.assetMan.CopyAsset(this.Image); } protected void finalize() { this.assetMan.RemoveAsset(this.Image); this.strImageFile = null; this.strStoreURL = null; this.cdp = null; this.codebase = null; this.assetMan = null; } public void onUnInstall(DAssetManager var1) { } public String onInstall(DAssetManager var1, String var2) { this.assetMan = var1; this.codebase = var2; this.strImageFile = this.codebase + "\\iCatBuilt.gif"; return "iCat Built"; } public void onInspect(CStringArray var1, CStringArray var2) { var1.Set("Store URL"); var2.Set("String"); var1.Set("Image"); var2.Set("Image"); } public String PropertyListener(String var1, String var2, int var3, int var4, IDInspector var5) { if (var3 == 1) { if (var1.compareTo("Store URL") == 0) { return this.strStoreURL; } if (var1.compareTo("Image") == 0) { return Integer.toString(this.Image); } } else { if (var1.compareTo("Store URL") == 0) { this.strStoreURL = var2; if (this.strStoreURL.length() != 0) { this.writeiCatFile(this.strStoreURL); } } else if (var1.compareTo("Image") == 0) { this.assetMan.RemoveAsset(this.Image); this.Image = Integer.parseInt(var2, 10); this.strImageFile = this.assetMan.GetAssetLocation(this.Image, 1, 1); DImage var6 = new DImage(); var6.setImageFile(this.strImageFile); DSize var7 = var6.getSize(); this.cdp.SetSize(var7.getWidth(), var7.getHeight()); this.cdp.setImageFile(this.assetMan.GetAssetLocation(this.Image, -1, 1)); } this.cdp.Invalidate(true); } if (var5 != null) { var5.OnPropertyChanged(-1); } return ""; } public void onDrop(DLayout var1, DRect var2, int var3) { if (var3 == 1) { this.cdp = new DDrawPicture(); this.cdp.SetPositionRect(var2.getLeft(), var2.getTop(), var2.getRight(), var2.getBottom()); this.cdp.SetStyle(1, 1); this.cdp.setStretch(2); this.cdp.setUsePictureText(false); DImage var4 = new DImage(); var4.setImageFile(this.strImageFile); DSize var5 = var4.getSize(); this.cdp.SetSize(var5.getWidth(), var5.getHeight()); this.cdp.setImageFile(this.strImageFile); var1.AddObject(this.cdp); } } public void onPublish(DAssetManager var1, int var2) { String var3 = "<A HREF=\"http://www.icat.com\" target=\"_top\" >"; this.cdp.setAltTag("This store was built using iCat technology."); this.cdp.setHTMLBefore(var3); this.cdp.setHTMLAfter("</A>"); if (this.strStoreURL.length() == 0) { DMessageBox var4 = new DMessageBox(); var4.Warning("The Store URL property of the iCatBuilt component MUST be filled in.\r\nPlease enter this value and republish your site.\r\n"); } } public void writeiCatFile(String var1) { DSite var2 = new DSite(); String var3 = var2.getName(); DFile var4 = new DFile(); if (var4.Open(this.codebase + "\\iCatInfo\\" + var3 + ".txt", 4097)) { var4.Seek(0, 0); var4.WriteString(var1, -1); var4.Close(); } else { DMessageBox var5 = new DMessageBox(); var5.Warning("The file (" + this.codebase + "iCatInfo\\" + var3 + ".txt) could not be created.\r\n" + "Without this file the iCat components will not publish correctly.\r\n"); } } public void removeAsset(int var1) { if (var1 != 0) { this.assetMan.RemoveAsset(var1); } } private void debug(String var1) { DMessageBox var2 = new DMessageBox(); var2.Warning(var1 + "\r\n"); } }